import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex)

//共享数据
const state = {
	count: 1
}
//操作
const mutations={
	increment(state) {
		state.count++
	},
	decrement(state) {
		state.count--
	}
}

// 提交
const actions = {
	increment: ({commit}) => {
		commit('increment')
	},
	decrement: ({commit}) => {
		commit('decrement')
	}
}

//导出模块
export default new Vuex.Store({
	state,mutations,actions
})